<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>工资</title>
</head>
<body>
    <script>
    //月薪 performance
    /*
    *   @func 计算工资
    *   @params monthSalary 月薪 数值类型
    *   level[S A B C D]
    *   @return total  number  总工资
    */
  function calculateSalory(monthSalary,level = 'C'){
    switch(level){
                case 'SSP':
                 return performanceSSP(monthSalary);
                 break;
                case 'S':
                 return performanceS(monthSalary);
                 break;
                case 'A':
                 return performanceA(monthSalary);
                 break;
                case 'B':
                 return performanceB(monthSalary);
                 break;
                case 'C':
                 return performanceC(monthSalary);
                 break;
                case 'D':
                 return performanceD(monthSalary);
                 break;
            }
  }


//财务执行
//解耦等级的工资制度
//SSP等级的工资计算方式
const performanceSSP = function(salary){
return salary * (12+10)
}
//S等级的工资计算方式
const performanceS = function(salary){
return salary * (12+6)
}
//A等级的工资计算方式
const performanceA = function(salary){
return salary * (12+4)
}
//B等级的工资计算方式
const performanceB = function(salary){
return salary * (12+3)
}
//C等级的工资计算方式
const performanceC = function(salary){
return salary * (12+2)
}
//D等级的工资计算方式
const performanceD = function(salary){
return salary * (12+1)
}
  let total = calculateSalory(20000,'S') 
  let a = calculateSalory(7000);
  let s = calculateSalory(20000,'SSP');
  console.log(total,a,s);
  
    </script>
</body>
</html>